package com.ricchieri.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Table(name="userPhone")
public class UserPhone extends BaseEntity {
	private static final long serialVersionUID = -5103517844173568696L;

	@Column(name="number", nullable=false, length=30)
	private String number;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "phoneType", nullable = false)
	private PhoneType phoneType;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user", nullable = false)
	private User user;
	
	@Column(name="isDefault")
	private Boolean isDefault = Boolean.FALSE;
	
	public UserPhone(){
		
	}
	
	public UserPhone(String number, PhoneType phoneType, User user) {
		this.number = number;
		this.phoneType = phoneType;
		this.user = user;
	}
	
	public String getNumber() {
		return number;
	}
	
	public void setNumber(String number) {
		this.number = number;
	}
	
	public PhoneType getPhoneType() {
		return phoneType;
	}
	
	public void setPhoneType(PhoneType phoneType) {
		this.phoneType = phoneType;
	}
	
	public User getUser() {
		return user;
	}
	
	public void setUser(User user) {
		this.user = user;
	}

	public Boolean getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(Boolean isDefault) {
		this.isDefault = isDefault;
	}	
}